/*
 * @Author: liu
 * @Date: 2024-04-19 23:23:26
 * @LastEditors: 鱿鱼溪学院
 * @LastEditTime: 2025-04-20 17:35:50
 * @FilePath: \yyx_ser_ts\app\router\decorator-router\course.ts
 * @Description:
 * 天道酬勤
 */
import { get, post, del, controller, use, unifyUse } from '../decorator/index'
import commonMiddleware from '../../middleware/common'
import { Context } from 'koa'

/** 装饰器router clsss */
export type RouterController<T extends string> = {
  [key in T]: (ctx: Context) => Promise<void>
}

type MethodName = 'getName' | 'postName' | 'deleteName'

@controller('/course')
@unifyUse<MethodName>(commonMiddleware)
class Course {
  //  @use(commonMiddleware)
  @get('/saveCourseInfo')
  async getName(ctx: Context) {
    //return TestController.test4(ctx)
  }

  @post('/aa')
  async postName(ctx: Context) {
    const { name } = ctx.request.body
    ctx.body = {
      name: name
    }
  }
}

export default new Course()
